# It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Endpoint Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description - Script to set DNS of a network service # Parameters - "" "" # Example: "AirPort" "8.8.8.8" # Example: "Ethernet" "100.22.2.42" # Configuration Type - COMPUTER if [ $# == '2' ]; then networksetup -setdnsservers $1 $2 ret=$? if [ $ret == "0" ]; then echo "DNS set Successfully" else echo "Error in DNS IP change" fi exit $ret else echo "Invalid Arguments - Please refer description of the script" exit 1 fi